package me.luger.provider.service;

import io.grpc.stub.StreamObserver;
import me.luger.dubbo3.entity.DubboGreeterGrpc;
import me.luger.dubbo3.entity.HelloReply;
import me.luger.dubbo3.entity.HelloRequest;
import org.apache.dubbo.config.annotation.DubboService;

@DubboService
public class HelloServiceImpl extends DubboGreeterGrpc.GreeterImplBase implements DubboGreeterGrpc.IGreeter {

    @Override
    public void sayHello(HelloRequest request, StreamObserver<HelloReply> responseObserver) {
        System.out.println("Executing thread is " + Thread.currentThread().getName());
        HelloReply reply = HelloReply.newBuilder().setMessage("Hello " + request.getName()).build();
        responseObserver.onNext(reply);
        responseObserver.onCompleted();
    }
}
